﻿using GRPCClass;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace sdtpsclientdemo
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void tsbutadd_Click(object sender, EventArgs e)
        { 
            TaskRequest mytr = new TaskRequest();
            mytr.ID = Guid.NewGuid().ToString();
            mytr.Name = "测试";
            mytr.CreateTime = DateTime.Now.ToString();
            mytr.TaskType = "test";
            mytr.TryCount = 3;
            mytr.OverTimeDuration = 1000;

            SdtpsRPCSDK.GRPCClient mygc = new SdtpsRPCSDK.GRPCClient();
            mygc.Servadd = toolStripComboBox1.Text; 

            TaskReply mygt= mygc.AddTask(mytr);
            richTextBox1.Text = mygt.Message;
             
        }

        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            SdtpsRPCSDK.GRPCClient mygc = new SdtpsRPCSDK.GRPCClient();
            mygc.Servadd = toolStripComboBox1.Text;// "192.168.50.149:9007";

            TaskRequest mytr = new TaskRequest();
            mytr.ID = Guid.NewGuid().ToString();
            mytr.Name = "测试";
            mytr.CreateTime = DateTime.Now.ToString();
            mytr.TaskType = "test";
            mytr.TryCount = 3;
            mytr.OverTimeDuration = 1000;

            TaskReply mygt = mygc.SayHello(mytr);
            richTextBox1.Text = mygt.Message;
           
        }

        private void tsbuticount_Click(object sender, EventArgs e)
        {
            SdtpsRPCSDK.GRPCClient mygc = new SdtpsRPCSDK.GRPCClient();
            mygc.Servadd = toolStripComboBox1.Text;// "192.168.50.149:9007";

            TaskRequest mytr = new TaskRequest();
            mytr.ID = Guid.NewGuid().ToString();
            mytr.Name = "测试";
            mytr.CreateTime = DateTime.Now.ToString();
            mytr.TaskType = "test";
            mytr.TryCount = 3;
            mytr.OverTimeDuration = 1000;

            TaskReply mygt = mygc.GetTaskNoEndCount(mytr);// .SayHello(mytr);
            richTextBox1.Text = mygt.Message;
        }

        private void tsbutwtask_Click(object sender, EventArgs e)
        {
            SdtpsRPCSDK.GRPCClient mygc = new SdtpsRPCSDK.GRPCClient();
            mygc.Servadd = toolStripComboBox1.Text;// "192.168.50.149:9007";

            TaskRequest mytr = new TaskRequest();
            mytr.ID = Guid.NewGuid().ToString();
            mytr.Name = "测试";
            mytr.CreateTime = DateTime.Now.ToString();
            mytr.TaskType = "test";
            mytr.TryCount = 3;
            mytr.OverTimeDuration = 1000;

            TaskReply mygt = mygc.GetTaskNoAllotCount(mytr);// .SayHello(mytr);
            richTextBox1.Text = mygt.Message;
        }

        private void tsbutnode_Click(object sender, EventArgs e)
        {
            richTextBox1.Text = SdtpsNodeLibrary.NodeHandle.SendEnroll();
        }
    }
}
